package cn.wolfcode.trip.app.controller;

import cn.wolfcode.trip.base.domain.TravelCollect;
import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.service.ITravelCollectService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/travelCollect")
public class TravelCollectController {

    @Autowired
    private ITravelCollectService travelCollectService;

    @GetMapping("/query/{userId}")
    public Object query(QueryObject qo,@PathVariable Long userId){
        PageInfo<TravelCollect> pageInfo=travelCollectService.query(qo,userId);
        return pageInfo;
    }
    @GetMapping("/getCollectByUserId/{userId}")
    public Object getCollectByUserId(@PathVariable Long userId,Long travelId,Long state){
        TravelCollect travelCollect = travelCollectService.getCollectByUserId(userId,travelId,state);
        return travelCollect;
    }
    @PostMapping("/{userId}")
    public Object selectCollect(@PathVariable Long userId,Long travelId){
        boolean flag = travelCollectService.selectCollect(userId,travelId);
        return flag;
    }
}
